<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>数据代理</title>
</head>
<body>

<div id="test">
    <ul id='ul'>
        <li>2</li>
        <li>2</li>
        <li>2</li>
    </ul>
</div>

<script type="text/javascript">
    let ul = document.querySelector('ul')
    let fragment = document.createDocumentFragment()
    let child
    while (child = ul.firstChild) {
        fragment.appendChild(child)
    }
    Array.from(fragment.childNodes).forEach(node => {
        if (node.nodeType === 1) {
            node.textContent = '123sss'
        }
    })
    ul.appendChild(fragment)
</script>
</body>
</html>